﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.App.Helpers
{
    public static class EnumerableHelper
    {
        public static TimeSpan Average(this IEnumerable<TimeSpan> values)
        {
            var averageTicks = (long) Math.Truncate(values.Select(timeSpan => timeSpan.Ticks).Average());
            return new TimeSpan(averageTicks);
        }
    }
}
